<template>
	<view>
		<view class="bgc">

			<view class="content">
				<view class="li" v-for="item in list" :key="item.cat_id"
					@click="$navTo(`pages/mines/policyDetails?content=${item.content}&time=${item.add_time}&title=${item.title}`)">
					<view class="name">
						{{item.title}}
					</view>
					<u-icon color="#d9d9d9" name="arrow-right"></u-icon>
				</view>
			</view>
		</view>

		<view class="btn" @click="fanhui">
			返回
		</view>
	</view>
</template>

<script>
	import {
		UserApi
	} from '@/api';
	export default {
		data() {
			return {
				p: 1,
				list: []

			};
		},
		onLoad() {
			this.getPrivate()
		},
		methods: {
			async getPrivate(bol = true) {
				try {
					if (bol) this.p = 1
					const res = await UserApi.getPrivate({
						size: 10,
						p: this.p
					})
					if (bol)
						return this.list = res.result.rows
					this.list.push(...res.result.rows)
				} catch (e) {
					//TODO handle the exception
				}
			},
			fanhui() {
				uni.navigateBack({
					delta: 1
				})
			}
		},
		onReachBottom() {
			this.p += 1
			this.getPrivate(false)
		}
	}
</script>

<style lang="scss" scoped>
	.btn {
		position: fixed;
		bottom: calc(30rpx + constant(safe-area-inset-bottom));
		bottom: calc(30rpx + env(safe-area-inset-bottom));
		left: 30rpx;
		width: 690rpx;
		height: 88rpx;
		border-radius: 50rpx;
		opacity: 1;
		background: linear-gradient(173.2deg, #f8b280 0%, #ff8b38 100%);
		font-size: 30rpx;
		color: #fff;
		font-weight: 400;
		text-align: center;
		line-height: 88rpx;
	}

	.bgc {
		background-color: #fef2e6;
		width: 100vw;
		height: 200rpx;
		position: relative;

		.content {
			position: absolute;
			top: 50rpx;
			left: 30rpx;
			width: 690rpx;
			background-color: #fff;
			border-radius: 12rpx;

			.li {
				display: flex;
				align-items: center;
				justify-content: space-between;
				width: 100%;
				height: calc(55rpx + 72rpx);
				box-sizing: border-box;
				border-bottom: 1rpx solid #ececec;
				padding: 0 24rpx;
				font-size: 28rpx;
				font-weight: 400;


			}
		}
	}
</style>